#include "test_module.h"
#include "test_user_module.h"

#include <mutex>

std::shared_ptr<TestUserModule> TestUserModule::GetInstance()
{
    if (instance == nullptr) {
        static std::mutex mutex;
        std::lock_guard<std::mutex> lock(mutex);
        if (instance == nullptr) {
            instance = std::make_shared<TestUserModule>();
        }
    }
    return instance;
}

int TestUserModule::Test()
{
    auto tm = delegator.Dep<TestModule>();
    if (tm == nullptr) {
        return -1;
    }
    return tm->Test() + 1;
}
